#!/bin/bash
# -*-sh-*-

TEST_LOGS=""
MAKEFLAGS=""
status=0

source ./common/TEST_ENV  || exit 1
source ./common/functions || exit 1

cd dev-tools/scipy || exit 1
export BATS_JUNIT_CLASS=SciPy

MPIs_local=`echo $MPI_FAMILIES | sed 's/impi//'`

for compiler in $COMPILER_FAMILIES ; do

    # gnu families only
    [[ ! $compiler =~ gnu ]] && continue
    
    for mpi in $MPIs_local ; do
        for python in $PYTHON_FAMILIES ; do

            get_python_vars $python

            echo " "
            echo " "
            echo "-------------------------------------------------------"
            echo "Dev Toolsk: $python-scipy tests: $compiler-$mpi"
            echo "-------------------------------------------------------"

            module purge                            || exit 1
            module load prun                        || exit 1
            module load $compiler                   || exit 1
            module load $mpi                        || exit 1
            module load $python_module_prefix-scipy || exit 1

            make clean                              || exit 1
            make -k check                           || status=1

            save_logs_mpi_family tests $python-$compiler $mpi

    	make clean
        done
    done
done

exit ${status}
